package com.ktjy.springredis.config;

import com.ktjy.springredis.web.interceptor.AuthorizationInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @return 13141
 * 2025/7/21
 * 08:39
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] pathPatterns = {"/choh6/*"}; // 拦截路径
        String[] excludePathPatterns = {"/", "/login", "/dologin", "/css/**", "/fonts/**",
        "/images/**", "/js/**", "/localcss/**", "/localjs/**"};
        registry.addInterceptor(new AuthorizationInterceptor())
            .addPathPatterns(pathPatterns)  // 添加路径规则
            .excludePathPatterns(excludePathPatterns);  // 添加排除路径规则
    }
}
